package test

import config.MyFile
import org.apache.commons.io.FileUtils
import utils.ExecCommand

object GetCdsAndPep extends MyFile{

  def main(args: Array[String]): Unit = {
    val path = "H:\\南农油茶数据库\\2024_10_8\\anno"
  val l =   path.listFile.map{x=>

      val pep = x.listFile.head.getName

      s"""
        |cd /mnt/sdb/xueweiqi/projects/camellia/og/${x.getName}
        |perl  /mnt/sdb/share/bin/produce_anno_sh.pl -db Eukaryota /mnt/sdb/xueweiqi/projects/camellia/og/${x.getName}/$pep
        |
        |sh Anno.sh
        |
        |""".stripMargin


    }.mkString("\n")

    println(l)
  }

  def copyFile = {
    val path = "H:\\南农油茶数据库\\2024_10_8\\gb"
    path.listFile.filter(_.getName.endsWith("pep")).foreach{x=>
      val p =  s"H:\\南农油茶数据库\\2024_10_8\\anno/${x.getName.dropRight(4)}"

      p.mkdirs
      FileUtils.copyFile(x,s"$p/${x.getName}".toFile)
    }
  }

  def getCds = {
    val path = "H:\\南农油茶数据库\\2024_10_8\\gb"
    path.listFile.foreach{x=>
      val command = "perl H:\\已完结项目\\藻类细胞器\\藻类细胞器数据库构建/genbank_parser_v4.0.pl --type all " + x.getAbsolutePath + ""
      val exec = new ExecCommand()
      exec.exect(Array(command), path)
    }
  }
}
